<div class="dotline"></div>
<?php
if (count($this->activities) == 0){?>

<div class="noResults">Nothing till now ... </div>
<?php if($this->withTips){?>
<div style="font-size:18px;font-weight:700;margin-left:10px;text-indent:35px;float:left;">Be the first to ... <a href="<?php echo $this->url(array('controller'=>'user','action'=>'register'),"default",true); ?>">Sign up</a> & <a href="<?php echo $this->url(array('controller'=>'book','action'=>'fetch'),null,true); ?>">Add Your Books</a> </div>
<?php }?>
<?php } else { ?>

<?php
foreach ($this->activities as $activity) {
switch($activity->type) {
			case Activity::ACTIVATE_USER:?>
			
				<li>
			<div class="actImg">
			<img src="<?php echo $this->userThumbnail($activity->user); ?>"/>
			<?php 
			$user = $activity->user;
$uc = User::checkUserAuthProvider($user, AuthProvider::FACEBOOK);
if (!empty($uc)) {
?><a target="_blank" id="fbIcon" title="<?php echo $user->name;?> has connected with Facebook, isn't he/she more trustworthy? Click to check out!" href="http://www.facebook.com/profile.php?id=<?php echo $uc->auth_uid;?>">
fb</a>
<?php }?>
			</div>
			<div class="actDesc">
			<h2><a href="<?php echo $this->url(array("controller"=>"user", "action"=>"profile", "uid"=>$activity->user->id), "default", true);?>">
			<?php echo $activity->presentUsername;?>
			</a></h2>
			<div class="actDetail">
				<span class="date"><?php echo $activity->date;?></span>
				<span><a href="<?php echo $this->url(array("controller"=>"user", "action"=>"profile", "uid"=>$activity->user->id), "default", true);?>">
			<?php echo $activity->presentUsername;?>
			</a> becomes member here!</span>
			</div>
			</div>			
			</li>
			<div class="dotline"></div>
				
				
				
				<?php 
			break;
			case Activity::USER_ADD_BOOK: ?>
			
			<li>
			<?php $book = $activity->book;
				$userBook = $activity->userBook;
				$usages = UserBookUsage::getUsageStrings($userBook->usage);				
			?>
			<div class="actImg">
			<img src="<?php echo $this->bookThumbnail($book); ?>"/>
			</div>
			<div class="actDesc">
			<h2><a href="<?php echo $this->url(array("controller"=>"book", "action"=>"detail", "id"=>$book->ISBN), "default", true);?>">
			<?php echo $activity->book->name;?>
			</a></h2>
			<div class="actDetail">
				<span class="date"><?php echo $activity->date;?></span>
				<span><a href="<?php echo $this->url(array("controller"=>"user", "action"=>"profile", "uid"=>$activity->user->id), "default", true);?>"><?php echo $activity->presentUsername;?></a> has this book for <strong><?php echo implode(", ",$usages);?></strong>.</span>
			</div>
			</div>			
			</li>
			<div class="dotline"></div>
							
		     <?php break;
            case Activity::USER_UPDATE_BOOK_STATUS:?>
            <li>
            <?php 
             $book = $activity->book;
             $userBook = $activity->userBook;
            ?>
            <div class="actImg">
            <img src="<?php echo $this->bookThumbnail($book);?>" />
            </div>
            <div class="actDesc">
            <h2><a href="<?php echo $this->url(array("controller"=>"book", "action"=>"detail", "id"=>$book->ISBN), "default", true);?>">
            <?php echo $activity->book->name;?>
            </a></h2>
            <div class="actDetail">
                <span class="date"><?php echo $activity->date;?></span>
                <span><a href="<?php echo $this->url(array("controller"=>"user", "action"=>"profile", "uid"=>$activity->user->id), "default", true);?>"><?php echo $activity->presentUsername;?></a> changed this book's status to <strong><?php echo $userBook->status;?></strong>.</span>
            </div>
            </div>          
            </li>
            <div class="dotline"></div>
		<?php break;}
} }?>